CochoAlert = function () {//构造函数

}

CochoAlert.prototype = { //定义方法
    notificationsWarn: function (messageHtml) {
        $.gritter.add({
            /*  示例
            // (string | mandatory) the heading of the notification
            title: 'This is a regular notice!',
            // (string | mandatory) the text inside the notification
            text: 'This will fade out after a certain amount of time.',
            // (string | optional) the image to display on the left
            image: 'http://a0.twimg.com/profile_images/59268975/jquery_avatar_bigger.png',
            // (bool | optional) if you want it to fade out on its own or just sit there
            sticky: false,
            // (int | optional) the time you want it to be alive for before fading out (milliseconds)
            time: 8000,
            // (string | optional) the class name you want to apply directly to the notification for custom styling
            class_name: 'my-class',
            // (function | optional) function called before it opens
             before_open: function () {
             if ($('.gritter-item-wrapper').length >= 3) {
             return false;
             }
             },
            // (function | optional) function called after it opens
            after_open: function(e){
                alert("I am a sticky called after it opens: \nI am passed the jQuery object for the created Gritter element...\n" + e);
            },
            // (function | optional) function called before it closes
            before_close: function(e, manual_close){
                // the manual_close param determined if they closed it by clicking the "x"
                alert("I am a sticky called before it closes: I am passed the jQuery object for the Gritter element... \n" + e);
            },
            // (function | optional) function called after it closes
            after_close: function(){
                alert('I am a sticky called after it closes');
            }
            */
            title: "警告提示",
            text: messageHtml,
            image: cochoApp.baseUrl + '/resources/images/utils/warning.png',
            sticky: false,
            class_name: 'gritter-warning gritter-light'
        });
    },


    notificationsError: function (messageHtml) {
        $.gritter.add({
            title: "异常提示",
            text: messageHtml,
            image: cochoApp.baseUrl + '/resources/images/utils/error.png',
            class_name: 'gritter-error gritter-light'
        });
    }




}
cochoAlert = new CochoAlert();
